#pragma once
class Chro
{
public:
	Chro(void);
	~Chro(void);

	
	bool CreateInitSolution();
	bool isValid();
	void Print();
	void Print(FILE* fp);
	void PrintToFile();
	void Init();
	void RandomInit();
	void RandomInitInfeasible();
	
	Chro operator=(Chro &ch0);
	bool operator==(Chro &ch0);
	Chro operator-(Chro &ch0);
	
	bool UpdateNode(int cls, int itemIndex);
	bool UpdateNode(int itemIndex);
	bool UpdateNodeCluster(int* cls, __int8* newIndex);
	bool CheckNodeClusterPossible(int* cls,int* newIndex);
	bool UpdateWeight();
	int UpdateValue();
	int UpdateInfeasibleValue();
	bool UpdateInfo();
	
	inline int GetGene(int cls){return gene[cls];}
	inline int GetWeight(int dim){return weight[dim];}
	inline int GetValue(){return value;}
	
	static CNodeTable* nt;
	static int aBottomGene[MAXCLASS];
	static bool bBottom;
	static void SetNodeTable(CNodeTable* cnt);
	static int Compare(Chro* c1,Chro *c2);


	static int pen_mmi ;
	static int	pen_mmd;
	static int	pen_mp ;
	static int	pen_ppd ;
	static int	pen_ppi ;
	static int	pen_pm ;
	
	static void SetYPParam(int,int,int,int,int,int);
	///// Repair
	int GetPenalty(int cls,int ind);
	int GetPenalty(int ind);

private:
	int value;
	__int16 gene[MAXCLASS];
	__int16 weight[MAXDIMENSION];

	friend class CPop;
};

